package de.zainodis.commons.model.binding;

import java.util.Collection;
import java.util.Iterator;

public interface IDatapath extends Iterable<IDatapath> {

   public static final String PATH_SEPARATOR = "/";

   @Override
   String toString();

   @Override
   Iterator<IDatapath> iterator();

   /**
    * Returns true if the value is part of this datapath; false otherwise.
    */
   boolean contains(String value);

   /**
    * Returns the last part of a {@link Datapath}. For instance - if the
    * datapath is Owner/Address/Street, then this method will return "Street" as
    * it is the last part of the datapath.
    */
   String getLastPart();

   /**
    * Splits an {@link IDatapath} into it's separate parts and returns a list
    * containing those parts.
    */
   Collection<IDatapath> split();

   boolean startsWith(String prefix);

   /**
    * @return true if this datapath matches an empty datapath (consisting of an
    *         empty String); false otherwise.
    */
   boolean isEmpty();

   /**
    * @return The length of an {@link IDatapath}. Empty datapaths have a length
    *         of zero.
    */
   int getLength();

}
